home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kleo / cryptobackend.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-02-13  |  4.5 KB  |  123 lines

  1. /*
  2.     kleo/cryptobackend.h
  3.  
  4.     This file is part of libkleopatra, the KDE keymanagement library
  5.     Copyright (c) 2004,2005 KlarΣlvdalens Datakonsult AB
  6.  
  7.     Libkleopatra is free software; you can redistribute it and/or
  8.     modify it under the terms of the GNU General Public License as
  9.     published by the Free Software Foundation; either version 2 of the
  10.     License, or (at your option) any later version.
  11.  
  12.     Libkleopatra is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.     General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU General Public License
  18.     along with this program; if not, write to the Free Software
  19.     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  
  21.     In addition, as a special exception, the copyright holders give
  22.     permission to link the code of this program with any edition of
  23.     the Qt library by Trolltech AS, Norway (or with modified versions
  24.     of Qt that use the same license as Qt), and distribute linked
  25.     combinations including the two.  You must obey the GNU General
  26.     Public License in all respects for all of the code used other than
  27.     Qt.  If you modify this file, you may extend this exception to
  28.     your version of the file, but you are not obligated to do so.  If
  29.     you do not wish to do so, delete this exception statement from
  30.     your version.
  31. */
  32.  
  33. #ifndef __KLEO_CRYPTOBACKEND_H__
  34. #define __KLEO_CRYPTOBACKEND_H__
  35.  
  36. #include <qstring.h>
  37.  
  38. namespace Kleo {
  39.   class CryptoConfig;
  40.   class KeyListJob;
  41.   class KeyGenerationJob;
  42.   class ImportJob;
  43.   class ExportJob;
  44.   class DownloadJob;
  45.   class DeleteJob;
  46.   class EncryptJob;
  47.   class DecryptJob;
  48.   class SignJob;
  49.   class VerifyDetachedJob;
  50.   class VerifyOpaqueJob;
  51.   class SignEncryptJob;
  52.   class DecryptVerifyJob;
  53.   class RefreshKeysJob;
  54.   class SpecialJob;
  55. }
  56.  
  57. class QString;
  58. class QVariant;
  59. template <typename T_Key, typename T_Value> class QMap;
  60.  
  61. namespace Kleo {
  62.  
  63.   class CryptoBackend {
  64.   public:
  65.     class Protocol;
  66.  
  67.     static const char OpenPGP[];
  68.     static const char SMIME[];
  69.  
  70.     virtual ~CryptoBackend() {}
  71.  
  72.     virtual QString name() const = 0;
  73.     virtual QString displayName() const = 0;
  74.  
  75.     virtual bool checkForOpenPGP( QString * reason=0 ) const = 0;
  76.     virtual bool checkForSMIME( QString * reason=0 ) const = 0;
  77.     virtual bool checkForProtocol( const char * name,  QString * reason=0 ) const = 0;
  78.  
  79.     virtual bool supportsOpenPGP() const = 0;
  80.     virtual bool supportsSMIME() const = 0;
  81.     virtual bool supportsProtocol( const char * name ) const = 0;
  82.  
  83.     virtual CryptoConfig * config() const = 0;
  84.  
  85.     virtual Protocol * openpgp() const = 0;
  86.     virtual Protocol * smime() const = 0;
  87.     virtual Protocol * protocol( const char * name ) const = 0;
  88.  
  89.     virtual const char * enumerateProtocols( int i ) const = 0;
  90.   };
  91.  
  92.   class CryptoBackend::Protocol {
  93.   public:
  94.     virtual ~Protocol() {}
  95.  
  96.     virtual QString name() const = 0;
  97.  
  98.     virtual QString displayName() const = 0;
  99.  
  100.     virtual KeyListJob        * keyListJob( bool remote=false, bool includeSigs=false, bool validate=false ) const = 0;
  101.     virtual EncryptJob        * encryptJob( bool armor=false, bool textmode=false ) const = 0;
  102.     virtual DecryptJob        * decryptJob() const = 0;
  103.     virtual SignJob           * signJob( bool armor=false, bool textMode=false ) const = 0;
  104.     virtual VerifyDetachedJob * verifyDetachedJob( bool textmode=false) const = 0;
  105.     virtual VerifyOpaqueJob   * verifyOpaqueJob( bool textmode=false ) const = 0;
  106.     virtual KeyGenerationJob  * keyGenerationJob() const = 0;
  107.     virtual ImportJob         * importJob() const = 0;
  108.     virtual ExportJob         * publicKeyExportJob( bool armor=false ) const = 0;
  109.     // @param charset the encoding of the passphrase in the exported file
  110.     virtual ExportJob         * secretKeyExportJob( bool armor=false, const QString& charset = QString::null ) const = 0;
  111.     virtual DownloadJob       * downloadJob( bool armor=false ) const = 0;
  112.     virtual DeleteJob         * deleteJob() const = 0;
  113.     virtual SignEncryptJob    * signEncryptJob( bool armor=false, bool textMode=false ) const = 0;
  114.     virtual DecryptVerifyJob  * decryptVerifyJob( bool textmode=false ) const = 0;
  115.     virtual RefreshKeysJob    * refreshKeysJob() const = 0;
  116.  
  117.     virtual SpecialJob        * specialJob( const char * type, const QMap<QString,QVariant> & args ) const = 0;
  118.   };
  119.  
  120. }
  121.  
  122. #endif // __KLEO_CRYPTOBACKEND_H__
  123.